package com.eliza.base.views.component.progress

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedCard
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController

/*
*
elevation：向组件添加阴影，使其看起来高于背景。
colors：使用 CardColors 类型设置容器及任何子项的默认颜色。
enabled：如果您为此参数传递 false，则卡片会显示为已停用，并且不会响应用户输入。
onClick：通常，Card 不接受点击事件。因此，您需要注意主要过载，它定义了一个 onClick 参数。如果您希望 Card 的实现响应用户的按压操作，则应使用此重载。
* */
/*
* 卡片本身没有滚动或关闭操作，但可以集成到提供这些功能的可组合项中。
* 例如，如需在卡片上实现滑动关闭，请将其与 SwipeToDismiss
* */
object CardX {
    @Composable
    fun Show(navController: NavController) {
        Column {
            CardMinimalExample()
            FilledCardExample()
            ElevatedCardExample()
            OutlinedCardExample()
        }
    }

    @Composable
    private fun CardMinimalExample() {
        Card() {
            Text(text = "Hello, world!")
        }
    }

    @Composable
    private fun FilledCardExample() {
        Card(
            colors = CardDefaults.cardColors(
                containerColor = MaterialTheme.colorScheme.surfaceVariant,
            ),
            modifier = Modifier
                .size(width = 240.dp, height = 100.dp)
        ) {
            Text(
                text = "Filled",
                modifier = Modifier
                    .padding(16.dp),
                textAlign = TextAlign.Center,
            )
        }
    }

    @Composable
    private fun ElevatedCardExample() {
        ElevatedCard(
            elevation = CardDefaults.cardElevation(
                defaultElevation = 6.dp
            ),
            modifier = Modifier
                .size(width = 240.dp, height = 100.dp)
        ) {
            Text(
                text = "Elevated",
                modifier = Modifier
                    .padding(16.dp),
                textAlign = TextAlign.Center,
            )
        }
    }

    @Composable
    private fun OutlinedCardExample() {
        OutlinedCard(
            colors = CardDefaults.cardColors(
                containerColor = MaterialTheme.colorScheme.surface,
            ),
            border = BorderStroke(1.dp, Color.Black),
            modifier = Modifier
                .size(width = 240.dp, height = 100.dp)
        ) {
            Text(
                text = "Outlined ".repeat(20),
                modifier = Modifier
                    .padding(16.dp),
                textAlign = TextAlign.Center,
            )
        }
    }

}
